home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ddj0997.zip / opo.txt < prev    next >
Text File  |  1997-07-22  |  2KB  |  71 lines

  1. _Leveraging Oracle Power Objects 2.1_
  2. by Douglas C. McArthur
  3.  
  4. Listing One
  5. 'Sub Click()
  6. ' Connect to database using proper connection string syntax
  7. ' for ODBC or ORACLE connection as specified in the popup
  8. ' list "popConnectionType" with radio buttons for "ODBC" and
  9. ' "ORACLE" values, and using values from fields "fldLogin",
  10. ' "fldPassword", and "fldDatabase" on user click.
  11.  
  12. DIM vConnectString as String
  13.  
  14. SELECT CASE popConnectionType.Value
  15.   CASE "ODBC"
  16.     vConnectString = "odbc:UID=" & fldLogin.Value &      &
  17.                      ";PWD="     & fldPassword.Value &   &
  18.                      ";DB="      & fldDatabase.Value
  19.   CASE "ORACLE"
  20.     vConnectString = "oracle:" & fldLogin.Value &        &
  21.                      "/"       & fldPassword.Value &     &
  22.                      IIF( ISNULL( fldDatabase.Value ),   &
  23.                           "", "@" & fldDatabase.Value    &
  24.                         )
  25. END SELECT
  26.  
  27. sesDatabase.RunConnect = vConnectString
  28. sesDatabase.Connect()
  29.  
  30. IF sesDatabase.IsConnected() THEN
  31.     frmMainMenu.OpenWindow()
  32. ELSE
  33.    MsgBox( "Unable to connect to database.  " &  &
  34.            "Check login name, password, and database name." )
  35. END IF
  36.  
  37. 'End Sub Click()
  38.  
  39.  
  40. Listing Two
  41. 'Function udmFindString( pRecordset, pColumnName, pString ) as Integer
  42. ' Loop through each row in pRecordSet, checking if
  43. ' pColumnName is equal to pString.  Return the row
  44. ' if a match is found, or a zero when no match.
  45. ' ====================================================================
  46.  
  47. FOR vRow = 1 TO pRecordset.GetRowCount()
  48.   pRecordset.SetCurRow( vRow )
  49.   IF pRecordset.GetColVal( pColumnName ) = pString THEN
  50.      FindString =3D vRow
  51.      EXIT FUNCTION
  52.   END IF
  53. NEXT
  54. FindString = 0
  55. 'End Function udmFindString()
  56.  
  57.  
  58. Listing Three
  59. 'Sub udmResizeToContainer()
  60. ' Set SizeX of field's class container and field itself to the number
  61. ' of pixels from class's PositionX and its container's SizeX.  
  62. ' ======================================================================
  63. Container.SizeX = Container.GetContainer().SizeX - Container.PositionX
  64.  
  65. Self.SizeX = Container.SizeX
  66. 'End Sub udmResizeToContainer()
  67.  
  68.  
  69.  
  70.  
  71.